<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	template="/templates/template.xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:nu="http://nu.jcperera.homeip.net/facelets" xmlns:p="http://primefaces.org/ui">

	<ui:param name="title" value="NU Application Scan Profile Parameter Page" />
	<f:metadata>
		<f:viewParam name="entityid" value="#{scanProfileParameterBean.entityid}" />
		<f:viewParam name="parentid" value="#{scanProfileParameterBean.parentid}" />
	</f:metadata>

	<ui:define name="body">
		<p:outputPanel>
			<p:messages id="edit-messages" autoUpdate="true" closable="true" showDetail="true" />

			<p:panel id="parent-2-panel" header="Parent Web Info Site" style="margin-bottom:10px;">
				<h:panelGrid columns="2">
					<h:outputLabel for="parent-2-entityid" value="ID: " />
					<p:inputText id="parent-2-entityid" value="#{scanProfileParameterBean.scanProfile.site.entityid}" required="false"
						label="ID" size="45" readonly="true" disabled="true" />

					<h:outputLabel for="parent-2-url" value="URL: *" />
					<p:inputText id="parent-2-url" value="#{scanProfileParameterBean.scanProfile.site.url}" required="true" label="URL"
						size="150" readonly="true" disabled="true" />

					<h:outputLabel for="parent-2-parameters" value="Parameters: *" />
					<p:inputText id="parent-2-parameters" value="#{scanProfileParameterBean.scanProfile.site.parameters}"
						required="true" label="Parameters" size="100" readonly="true" disabled="true" />
				</h:panelGrid>
			</p:panel>

			<p:panel id="parent-1-panel" header="Parent Scan Profile" style="margin-bottom:10px;">
				<h:panelGrid columns="3" style="margin-bottom:10px;">
					<h:outputLabel for="parent-1-entityid" value="ID: " />
					<p:inputText id="parent-1-entityid" value="#{scanProfileParameterBean.scanProfile.entityid}" required="false"
						label="ID" size="45" readonly="true" disabled="true" />
					<p:message for="parent-1-entityid" />

					<h:outputLabel for="parent-1-name" value="Name: " />
					<p:inputText id="parent-1-name" value="#{scanProfileParameterBean.scanProfile.name}" required="true" label="Name"
						size="100" readonly="true" disabled="true">
						<f:validateLength minimum="4" />
					</p:inputText>
					<p:message for="parent-1-entityid" />

					<h:outputLabel for="parent-1-periodicity" value="Periodicity: *" />
					<p:inputText id="parent-1-periodicity" value="#{scanProfileParameterBean.scanProfile.periodicity}" required="true"
						label="Periodicity" size="6" readonly="true" disabled="true">
						<f:validateLength minimum="1" />
					</p:inputText>
					<p:message for="parent-1-periodicity" />

					<h:outputLabel for="parent-1-periodicityUnit" value="Periodicity Unit: *" />
					<p:inputText id="parent-1-periodicityUnit" value="#{scanProfileParameterBean.scanProfile.periodicityUnit}"
						required="true" label="Periodicity Unit" readonly="true" disabled="true" size="10" />
					<p:message for="parent-1-periodicityUnit" />

					<h:outputLabel for="parent-1-howManyUp" value="How Many Up: *" />
					<p:inputText id="parent-1-howManyUp" value="#{scanProfileParameterBean.scanProfile.howManyUp}" required="true"
						label="howManyUp" size="6" readonly="true" disabled="true">
						<f:validateLength minimum="1" />
						<f:validateLongRange minimum="0" maximum="99999" />
					</p:inputText>
					<p:message for="parent-1-howManyUp" />

					<h:outputLabel for="parent-1-howManyDown" value="How Many Down: *" />
					<p:inputText id="parent-1-howManyDown" value="#{scanProfileParameterBean.scanProfile.howManyDown}" required="true"
						label="howManyDown" size="6" readonly="true" disabled="true">
						<f:validateLength minimum="1" />
						<f:validateLongRange minimum="0" maximum="99999" />
					</p:inputText>
					<p:message for="parent-1-howManyDown" />

					<h:outputLabel for="parent-1-fetchNextDelay" value="Fetch Next Delay: *" />
					<p:inputText id="parent-1-fetchNextDelay" value="#{scanProfileBean.fetchNextDelay}" required="true"
						label="Fetch Next Delay" size="6" readonly="true" disabled="true">
						<f:validateLength minimum="1" />
					</p:inputText>
					<p:message for="parent-1-fetchNextDelay" />

					<h:outputLabel for="parent-1-fetchNextDelayUnit" value="Fetch Next Delay Unit: *" />
					<p:inputText id="parent-1-fetchNextDelayUnit" value="#{scanProfileBean.fetchNextDelayUnit}" required="true"
						label="Fetch Next Delay Unit" readonly="true" disabled="true" size="10" />
					<p:message for="parent-1-fetchNextDelayUnit" />

					<h:outputLabel for="parent-1-tolerance" value="Tolerance: *" />
					<p:inputText id="parent-1-tolerance" value="#{scanProfileParameterBean.scanProfile.tolerance}" required="true"
						label="Tolerance" size="6" readonly="true" disabled="true">
						<f:validateLength minimum="1" />
					</p:inputText>
					<p:message for="parent-1-tolerance" />

					<h:outputLabel for="parent-1-toleranceUnit" value="Tolerance Unit: *" />
					<p:inputText id="parent-1-toleranceUnit" value="#{scanProfileParameterBean.scanProfile.toleranceUnit}"
						required="true" label="Tolerance Unit" readonly="true" disabled="true" size="10" />
					<p:message for="parent-1-toleranceUnit" />

				</h:panelGrid>
			</p:panel>

			<p:panel id="edit-panel" header="Create new Scan Profile Parameter" style="margin-bottom:10px;">
				<h:panelGrid columns="3" style="margin-bottom:10px;">
					<h:outputLabel for="entityid" value="ID: " />
					<p:inputText id="entityid" value="#{scanProfileParameterBean.entityid}" required="false" label="ID" size="45"
						readonly="true" disabled="true" />
					<p:message for="entityid" />

					<h:outputLabel for="code" value="Code: *" />
					<p:inputText id="code" value="#{scanProfileParameterBean.code}" required="true" label="Code" size="50">
						<f:validateLength minimum="4" />
					</p:inputText>
					<p:message for="code" />

					<h:outputLabel for="name" value="Name: *" />
					<p:inputText id="name" value="#{scanProfileParameterBean.name}" required="true" label="Name" size="100">
						<f:validateLength minimum="4" />
					</p:inputText>
					<p:message for="name" />

					<h:outputLabel for="fixedValue" value="Fixed Value: *" />
					<p:inputText id="fixedValue" value="#{scanProfileParameterBean.fixedValue}" required="true" label="Fixed Value"
						size="100">
						<f:validateLength minimum="4" />
					</p:inputText>
					<p:message for="fixedValue" />

					<h:outputLabel for="currentValue" value="Current Value: *" />
					<p:inputText id="currentValue" value="#{scanProfileParameterBean.currentValue}" required="true"
						label="Current Value" size="100" readonly="true" disabled="true" />
					<p:message for="currentValue" />
				</h:panelGrid>

				<p:commandButton value="Save" action="#{scanProfileParameterBean.saveScanProfileParameter}" id="saveButton"
					icon="ui-icon-disk" update="edit-panel,edit-messages"></p:commandButton>

				<p:button value="Go to parent" outcome="/pages/scanprofile/edit.xhtml?faces-redirect=true" process="@this">
					<f:param name="entityid" value="#{scanProfileParameterBean.parentid}" />
				</p:button>
			</p:panel>
		</p:outputPanel>
	</ui:define>
</ui:composition>